import xml.dom.minidom
import xml.dom
import uuid
from PyMybatis import SqlSession
from bs4 import BeautifulSoup
import codecs

from lxml import etree


"""测试用例"""

# 配置
options = {
    'user': 'normal',
    'password': 'normal',
    'db': 'phy',
    'mapper': ['UserMapper.xml'],

}

session = SqlSession.build(options)
print(session.insert('User', 'add', {'name': 'JackBi', 'age': 95}))
# print(session.query('User', 'findall', {}))
# doc = BeautifulSoup(codecs.open('UserMapper.xml', encoding='utf8'), 'xml')
# print(doc.find('mapper').attrs['namespace'])
# sql_list = doc.find_all('sql')
# for sql in sql_list:
#     # print('sql:', sql)
#     print('id:', sql.attrs['id'])  # 获取属性（包装为dict）
#     print('name', sql.name)  # 标签名
#     print('text:', sql.text.strip())
#     # print('child:', type(sql.contents[2]))
#     if sql.find_all('if'):
#         print(sql.find_all('if')[0])
#     pass

# sqls = sql_list.xpath('//sql')
# print(sqls)

